package com.xiaohongshu.kafkademo.service;


import com.xiaohongshu.kafkademo.entity.Book;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
@Slf4j
public class UserChangeConsumerService {




    @Value("${kafka.topic.my-topic3}")
    private String myTopic3;


    @KafkaListener(topics = {"${kafka.topic.my-topic3}"}, groupId = "group1")
    public void consumeMessage2(Map<String, Object> changeMessage) {
        log.info("消费者消费{}的消息 -> {}", myTopic3, changeMessage.toString());
        log.info("数据库:{}", changeMessage.get("database"));
        log.info("表:{}", changeMessage.get("table"));
        log.info("操作类型:{}", changeMessage.get("eventType"));
        log.info("数据:{}", changeMessage.get("afterData"));
        log.info("执行时间:{}", changeMessage.get("executeTime"));
    }

}
